import os

remove_file_number = 0

main_path = "/home/wodden/.local/share/nvim/swap/"
all_files = os.listdir(main_path)

for i in all_files:
    try:
        cmd = f"{main_path}{i}"
        os.remove(cmd)
        remove_file_number += 1
        print(f"{i} is removed")
    except IsADirectoryError:
        print(f"exist dir {i} can't remove")

if remove_file_number == 0:
    print("no file need to remove")
    exit(0)
print(f"all removed {remove_file_number} files")
print("remove is complete!")

